
<?php
@include 'db.inc.php';

$ArchivNr = $_POST['ArchivNr'];

$SuchArchivNr = "SELECT a.ArchivNr,  a.ArchivText, a.Projektleiter, a.FK_TypNr, a.FK_StatusNr, a.FK_SolutionNr, a.FK_SolutionNr, a.FK_AbacusNr, a.FK_StandortNr, a.DatumInhalt_von, a.DatumInhalt_bis, a.DatumArchivierung, a.DatumVernichten, b.TypName, c.StatusName, d.SolutionSuchbegriff, d.SolutionMandat, e.StandortName, f.AbacusName
FROM archiv_bracher.Archiv a
LEFT JOIN archiv_bracher.Typ b ON a.FK_TypNr=b.TypNr
LEFT JOIN archiv_bracher.Status c ON a.FK_StatusNr=c.StatusNr
LEFT JOIN archiv_bracher.Solution d ON a.FK_SolutionNr=d.SolutionNr
LEFT JOIN archiv_bracher.Standort e ON a.FK_StandortNr=e.StandortNr
LEFT JOIN archiv_bracher.Abacus f ON a.FK_AbacusNr=f.AbacusNr
WHERE a.ArchivNr='$ArchivNr'";

$ergebnis = mysql_query($SuchArchivNr) or die("SQL-Abfrage nicht erfolgreich...");
$row = mysql_num_rows($ergebnis);

while ($row = mysql_fetch_object($ergebnis)) {
    $ArchivNr = $row->ArchivNr;
    $ArchivText = $row->ArchivText;
    $Projektleiter = $row->Projektleiter;
    $AbacusName = $row->AbacusName;
    $AbacusNr = $row->FK_AbacusNr;
    $TypName = $row->TypName;
    $StatusName = $row->StatusName;
    $StatusNr = $row->FK_StatusNr;
    $DatumInhalt_von = $row->DatumInhalt_von;
    $DatumInhalt_bis = $row->DatumInhalt_bis;
    $DatumArchivierung = $row->DatumArchivierung;
    $DatumVernichten = $row->DatumVernichten;
    $StandortName = $row->StandortName;
    $SolutionNr = $row->FK_SolutionNr;
    $SolutionName = $row->SolutionMandat;
}
?>
<form action = "datenKorrigieren.php" method = "POST">
    <table cellspacing="0" cellpadding="0" border="0" border-color="black">
        <tr>
            <td class="col-0"><lable for="Archivtyp">Archivtyp:</lable></td>
        <td class="col-1" colspan="3"><input type="text" name="Archivtyp"  size="20" maxlength="11" value="<?php echo $TypName ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="ArchivNr">Archiv Nummer</lable></td>
        <td class="col-1" colspan="3"><input type="text" name="ArchivNr"  size="20" maxlength="11" value="<?php echo $ArchivNr ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="archivtext">Archivtext:</lable></td>
        <td class="col-1" colspan="3" colspan=3><textarea name="archivtext" id="archivtext" readonly="readonly" value="<?php echo $ArchivText ?>" maxlength="200" cols="100" rows="3" style="width: 420px; height: 50px;resize:none;"><?php echo $ArchivText ?></textarea></td>                           
        </tr>
        <tr>
            <td class="col-0"><lable for="Standort">Standort:</lable></td>
        <td class="col-1" colspan=3><input type="text" name="Standort"  size="20" maxlength="11" value="<?php echo $StandortName ?>" readonly="readonly"/></td>
        </td>
        <tr>
            <td class="col-0"><lable for="verfall">Datum Inhalt von:</lable></td>
        <td class="col-1"><input type="text" name="datum_von"  size="20" value="<?php echo $DatumInhalt_von ?>" readonly="readonly"/></td>
        <td class="col-2"><lable for="datum_bis">Datum Inhalt bis:</lable></td>
        <td class="col-3"><input type="text" name="datum_bis"  size="20" value="<?php echo $DatumInhalt_bis ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="Archivierung">Datum Archivierung:</lable></td>
        <td class="col-1"><input type="text" name="Archivierung"  size="20" value="<?php echo $DatumArchivierung ?>" readonly="readonly"/></td>
        <td class="col-2"><lable for="Verfall">Datum Verfall:</lable></td>
        <td class="col-3"><input type="text" name="Verfall"  size="20" value="<?php echo $DatumVernichten ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="SolutionNr">Solution Nummer:</lable></td>
        <td class="col-1"><input type="text" name="SolutionNr"  size="20" value="<?php echo $SolutionNr ?>" readonly="readonly"/></td>
        <td class="col-2"><lable for="SolutionName">Solution Name:</lable></td>
        <td class="col-3"><input type="text" name="SolutionName"  size="20" value="<?php echo $SolutionName ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="AbacusNr">Abacus Nummer:</lable></td>
        <td class="col-1"><input type="text" name="AbacusNr"  size="20" value="<?php echo $AbacusNr ?>" readonly="readonly"/></td>
        <td class="col-2"><lable for="AbacusName">Abacus Name:</lable></td>
        <td class="col-3"><input type="text" name="AbacusName"  size="20" value="<?php echo $AbacusName ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="Projektleiter">Projektleiter:</lable></td>
        <td class="col-1" colspan="3"><input type="text" name="Projektleiter"  size="20" maxlength="11" value="<?php echo $Projektleiter ?>" readonly="readonly"/></td>
        </tr>
        <tr>
            <td class="col-0"><lable for="Status">Status:</lable></td>
        <td class="col-1" colspan="3"><input type = 'radio' name = 'Status' value ='<?php echo $StatusNr ?>' checked> <?php echo $StatusName ?></input></td>
        </tr>

        <?php
        @session_start();
        if ($_SESSION['eingeloggt'] == true) {

            echo "
        <tr>
            <td class='col-0'><lable for='Status'></lable></td>
            <td colspan='3'>
                <input type='submit' value='Daten bearbeiten!' name='datenKorrigierte' />
                <input type='button' value='Abschliessen' onClick='self.location.href='neu.php'' />
            </td>
        </tr>
        ";
        }
        ?>        
    </table>
    <br /><br />
</form>
